package com.example.doubledatasource.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.doubledatasource.entity.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 产品Mapper接口 - 从数据源
 * 
 * @author example
 * @since 1.0.0
 */
@Mapper
public interface ProductMapper extends BaseMapper<Product> {

    /**
     * 根据产品名称查询产品
     */
    @Select("SELECT * FROM product WHERE name LIKE CONCAT('%', #{name}, '%')")
    List<Product> findByNameLike(String name);

    /**
     * 查询库存充足的产品
     */
    List<Product> findProductsInStock();
}
